package net.mingsoft.report_data.kafka.deserializer;

import net.mingsoft.report_data.kafka.avro.ZkReport;
import net.mingsoft.report_data.util.AvroUtil;
import org.apache.kafka.common.serialization.Deserializer;

import java.util.Map;

/**
 * @author gengfa
 * @date 22/03/25
 */
public class AvroDeserializer implements Deserializer<ZkReport> {

    @Override
    public void configure(Map<String, ?> configs, boolean isKey) {}

    @Override
    public ZkReport deserialize(String s, byte[] bytes) {
        if (bytes == null) {
            return null;
        }
        return AvroUtil.deserialize(bytes, ZkReport.class);
    }

    @Override
    public void close() {}
}
